<template>
	<view>
		<swiper class="screen-swiper" :class="dotStyle?'square-dot':'round-dot'" :indicator-dots="true" :circular="true"
		 :autoplay="true" interval="5000" duration="500">
			<swiper-item v-for="(item,index) in swiperList" :key="index">
				<image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
				<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type=='video'"></video>
			</swiper-item>
		</swiper>

		<view class="categorymain">
			 <view class="margin-top"></view>
			<view v-for=" item  in lanmu" :key="item.id">
				<view class="cu-bar bg-blue light solid-bottom ">
					<view class="text-bold">
						<text class="cuIcon-titles text-orange "></text> {{item.title}}
					</view>
				</view>
				<view class="cu-list menu ">
					<view v-for="son in item.sunList" :key="son.id" class="cu-item arrow" @click="navToList(item)">
						<view class="content padding-tb-sm">
							<view>
								<text class="margin-right-xs"></text>{{son.title}}</view>
							<view v-if="son.zhaiyao" class="text-gray text-sm">
								<text class="cuIcon-infofill margin-right-xs"></text> {{son.zhaiyao}}</view>
						</view>

					</view>



				</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				swiperList: [{
						type: 'image',
						url: 'http://www.zyiz.net/images/minapp/zyiz_banner1.jpg?v=2',
						content: '找一找教程网欢迎您！'
					},
					{
						type: 'image',
						url: 'http://www.zyiz.net/images/minapp/zyiz_banner2.jpg?=2',
						content: '找一找教程网助你自学软件编程！'
					}
				],
				dotStyle: false,
				lanmu: [],
			}
		},
		onShareAppMessage() {
			return {
				title: getApp().globalData.title+'-所有栏目',
				content:  getApp().globalData.description,
				path: '/pages/category/category',
				imageUrl: getApp().globalData.zyiz_share_img
			}
		},
		onShow: function() {
			// #ifdef  MP-BAIDU
			    swan.showFavoriteGuide({
			        type: 'bar',
			        content:'关注找一找教程网小程序'
			    });
			swan.setPageInfo({
				title:getApp().globalData.title+'-所有栏目',
				keywords: getApp().globalData.keywords,
				description: getApp().globalData.description,
				articleTitle: getApp().globalData.articleTitle+'-所有栏目',
				releaseDate: getApp().globalData.releaseDate,
				image: getApp().globalData.zyiz_image,
				video: ''
			});
			// #endif
		
		},
		onLoad() {

			this.getCategorylist();
		},
		methods: {

			getCategorylist() {

				var zyizurl = getApp().globalData.zyiz_domain + '/api/Zyiz/CategoryList/0';
				uni.request({
					url: zyizurl,
					success: (result) => {

						if (result.statusCode == 200) {
							console.log("栏目结果：");
							console.log(result);

							this.lanmu = result.data.data;

						}

					}
				});

			},
			//新闻详情
			navToList(item) {
				 
				uni.navigateTo({
				 
					url: '/pages/list/list?query=' +item.id
				})
			},

		}
	}
</script>

<style>

</style>
